Make GtkEntryCompletion::text_column a property.
authorMatthias Clasen <matthiasc@src.gnome.org>
Thu, 27 May 2004 04:46:42 +0000 (04:46 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 27 May 2004 04:46:42 +0000 (04:46 +0000)
ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
docs/reference/ChangeLog
docs/reference/gtk/gtk-sections.txt
docs/reference/gtk/tmpl/gtkentrycompletion.sgml
gtk/gtkentrycompletion.c
gtk/gtkentrycompletion.h

index 1a9a138b9933b72ddaf88f66642116e12e7655bb..bede3d6f9fee59db4b3baa35402b64abbdc1029b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu May 27 00:45:07 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentrycompletion.h:
+       * gtk/gtkentrycompletion.c (gtk_entry_completion_get_text_column): 
+       Getter for text_column. Also make ::text_column a property.
+
 Thu May 27 00:11:01 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkmenuitem.c (gtk_menu_item_size_request): Fix a typo.
index 1a9a138b9933b72ddaf88f66642116e12e7655bb..bede3d6f9fee59db4b3baa35402b64abbdc1029b 100644 (file)
@@ -1,3 +1,9 @@
+Thu May 27 00:45:07 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentrycompletion.h:
+       * gtk/gtkentrycompletion.c (gtk_entry_completion_get_text_column): 
+       Getter for text_column. Also make ::text_column a property.
+
 Thu May 27 00:11:01 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkmenuitem.c (gtk_menu_item_size_request): Fix a typo.
index 1a9a138b9933b72ddaf88f66642116e12e7655bb..bede3d6f9fee59db4b3baa35402b64abbdc1029b 100644 (file)
@@ -1,3 +1,9 @@
+Thu May 27 00:45:07 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentrycompletion.h:
+       * gtk/gtkentrycompletion.c (gtk_entry_completion_get_text_column): 
+       Getter for text_column. Also make ::text_column a property.
+
 Thu May 27 00:11:01 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkmenuitem.c (gtk_menu_item_size_request): Fix a typo.
index 1a9a138b9933b72ddaf88f66642116e12e7655bb..bede3d6f9fee59db4b3baa35402b64abbdc1029b 100644 (file)
@@ -1,3 +1,9 @@
+Thu May 27 00:45:07 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentrycompletion.h:
+       * gtk/gtkentrycompletion.c (gtk_entry_completion_get_text_column): 
+       Getter for text_column. Also make ::text_column a property.
+
 Thu May 27 00:11:01 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkmenuitem.c (gtk_menu_item_size_request): Fix a typo.
index cf25269c7018819fa7cda156da63dffa18f5aeed..5c4968f6318e4e724655c4c7909bd3bb4964f97f 100644 (file)
@@ -1,3 +1,12 @@
+Thu May 27 00:44:48 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtk-sections.txt: Add gtk_entry_completion_get_text_column.
+
+Thu May 27 00:20:52 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/tmpl/gtkentrycompletion.sgml: Add notes about 
+       GtkEntryCompletionMatchFunc.
+
 Tue May 25 21:54:55 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/tmpl/gtkframe.sgml: Move docs inline.
index 664fc9f9d61c8015bda0ae22a078a5fab7c7e186..e8547262400289b7778cbaf93091bf39c460143f 100644 (file)
@@ -1047,6 +1047,7 @@ gtk_entry_completion_insert_action_text
 gtk_entry_completion_insert_action_markup
 gtk_entry_completion_delete_action
 gtk_entry_completion_set_text_column
+gtk_entry_completion_get_text_column
 <SUBSECTION Standard>
 GTK_TYPE_ENTRY_COMPLETION
 GTK_ENTRY_COMPLETION
index 48f525e9512434c8e6947ce0f991122af499fafc..ddbc41625c6a09653fd4ff53d3e8396c534e186e 100644 (file)
@@ -80,11 +80,14 @@ The GtkEntryCompletion struct contains only private data.
 <!-- ##### USER_FUNCTION GtkEntryCompletionMatchFunc ##### -->
 <para>
 A function which decides whether the row indicated by @iter matches a given 
-@key, and should be displayed as a possible completion for @key.
+@key, and should be displayed as a possible completion for @key. Note that
+@key is normalized and case-folded (see g_utf8_normalize() and 
+g_utf8_casefold()). If this is not appropriate, match functions have access
+to the unmodified key via <literal>gtk_entry_get_text (GTK_ENTRY (gtk_entry_completion_get_entry (<!-- -->)))</literal>.
 </para>
 
 @completion: the #GtkEntryCompletion
-@key: the string to match
+@key: the string to match, normalized and case-folded
 @iter: a #GtkTreeIter indicating the row to match
 @user_data: user data given to gtk_entry_completion_set_match_func()
 @Returns: %TRUE if @iter should be displayed as a possible completion for @key
index d7cd492b92985015e8901c4ac3a8d53e85968cf4..b50549cd52c86e7b0febb18780b47ed5c3f6d820 100644 (file)
@@ -51,7 +51,8 @@ enum
 {
   PROP_0,
   PROP_MODEL,
-  PROP_MINIMUM_KEY_LENGTH
+  PROP_MINIMUM_KEY_LENGTH,
+  PROP_TEXT_COLUMN
 };
 
 #define GTK_ENTRY_COMPLETION_GET_PRIVATE(obj)(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletionPrivate))
@@ -238,6 +239,22 @@ gtk_entry_completion_class_init (GtkEntryCompletionClass *klass)
                                                      G_MAXINT,
                                                      1,
                                                      G_PARAM_READWRITE));
+  /**
+   * GtkEntryCompletion::text-column:
+   *
+   * The column of the model containing the strings.
+   *
+   * Since: 2.6
+   */
+  g_object_class_install_property (object_class,
+                                   PROP_TEXT_COLUMN,
+                                   g_param_spec_int ("text_column",
+                                                     P_("Text column"),
+                                                     P_("The column of the model containing the strings."),
+                                                     -1,
+                                                     G_MAXINT,
+                                                     -1,
+                                                     G_PARAM_READWRITE));
 
   g_type_class_add_private (object_class, sizeof (GtkEntryCompletionPrivate));
 }
@@ -358,6 +375,7 @@ gtk_entry_completion_set_property (GObject      *object,
                                    GParamSpec   *pspec)
 {
   GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (object);
+  GtkEntryCompletionPrivate *priv = GTK_ENTRY_COMPLETION_GET_PRIVATE (completion);
 
   switch (prop_id)
     {
@@ -371,6 +389,10 @@ gtk_entry_completion_set_property (GObject      *object,
                                                      g_value_get_int (value));
         break;
 
+      case PROP_TEXT_COLUMN:
+       priv->text_column = g_value_get_int (value);
+        break;
+
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -396,6 +418,10 @@ gtk_entry_completion_get_property (GObject    *object,
         g_value_set_int (value, gtk_entry_completion_get_minimum_key_length (completion));
         break;
 
+      case PROP_TEXT_COLUMN:
+        g_value_set_int (value, gtk_entry_completion_get_text_column (completion));
+        break;
+
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -1021,8 +1047,9 @@ gtk_entry_completion_delete_action (GtkEntryCompletion *completion,
  * to have a list displaying all (and just) strings in the completion list,
  * and to get those strings from @column in the model of @completion.
  *
- * This functions creates and adds a GtkCellRendererText for the selected column.
-
+ * This functions creates and adds a #GtkCellRendererText for the selected 
+ * column.
+ * 
  * Since: 2.4
  */
 void
@@ -1042,6 +1069,26 @@ gtk_entry_completion_set_text_column (GtkEntryCompletion *completion,
   gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (completion),
                                  cell,
                                  "text", column);
+
+  g_object_notify (completion, "text_column");
+}
+
+/**
+ * gtk_entry_completion_get_text_column:
+ * @completion: a #GtkEntryCompletion
+ * 
+ * Returns the column in the model of @completion to get strings from.
+ * 
+ * Return value: the column containing the strings
+ *
+ * Since: 2.6
+ **/
+gint
+gtk_entry_completion_get_text_column (GtkEntryCompletion *completion)
+{
+  g_return_if_fail (GTK_IS_ENTRY_COMPLETION (completion));
+
+  return completion->priv->text_column;  
 }
 
 /* private */
index aed8165070e3b77bad601c7edf59b5f375448ba8..1a3cacf499f2a6c5c22675defcb8295e98c1e433 100644 (file)
@@ -102,6 +102,7 @@ void                gtk_entry_completion_delete_action          (GtkEntryComplet
 /* convenience */
 void                gtk_entry_completion_set_text_column        (GtkEntryCompletion          *completion,
                                                                  gint                         column);
+gint                gtk_entry_completion_get_text_column        (GtkEntryCompletion          *completion);
 
 G_END_DECLS